import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)


export const store = new Vuex.Store({
	state : {
		// 定义属性
		city : ""
	},
	getters : {
		// 获取属性的状态
		getCity : function(state){
			return state.city ? state.city : localStorage.city
		}
	},
	mutations : {
		// 改变属性的状态
		setCityHandle : function(state,data){
            state.city = data;
            localStorage.city = data;
		}
	},
	actions : {
		// 应用mutations
	}
})